package masterjava.common.shared.rpc;

import com.google.gwt.user.client.rpc.AsyncCallback;
import masterjava.common.shared.FetchContext;
import masterjava.common.shared.entity.GenericEntity;

import java.io.Serializable;
import java.util.List;

public interface DaoRemoteServiceAsync {
    void get(String persistentClass, Serializable id, AsyncCallback<? extends GenericEntity> callback);

    void saveOrUpdate(GenericEntity entity, AsyncCallback<? extends Serializable> callback);

    void loadAll(String persistentClass, FetchContext ctx, AsyncCallback<List<? extends GenericEntity>> callback);

    void delete(String persistentClass, Serializable id, AsyncCallback<Void> callback);

    void findByNamedQueryAndNamedParam(final String queryName, final String[] paramNames, final Serializable[] values, FetchContext ctx, AsyncCallback<List<? extends GenericEntity>> callback);

    void findUnique(final String queryName, final String[] paramNames, Serializable[] values, AsyncCallback<? extends GenericEntity> callback);
}
